﻿using HANS_Base.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using HANS.Utility;
using HANS.Utility.Extensions;

namespace HANS_Base.Services
{
    public static class FileUploadServices
    {


        /// <summary>
        /// 返回头像的FilePut参数
        /// </summary>
        /// <returns></returns>
        public static FileUploadModel SetFaceIma() {
            return new FileUploadModel() {
                overwriteInitial = false,
                maxFileSize = 1500,
                showClose = false,
                showCaption = false,
                showUpload=false,
                showBrowse=false,
                browseOnZoneClick=true,
                defaultPreviewContent= @"<img src='../content/Image/FaceImage/default_male.jpg' alt='FaceImage' style='width:160px'><h6 class='text - muted'>点击选择</h6>",
                allowedFileExtensions=  new string[]{ "jpg","png","gif"} 
            };
        }

        /// <summary>
        /// 个人中心上传参数
        /// </summary>
        /// <param name="facePath"></param>
        /// <returns></returns>
        public static FileUploadModel SetFaceIma(string facePath)
        {
            if (!string.IsNullOrWhiteSpace(facePath))
            {
                facePath = facePath.Replace("~", "..");
            }
            else
            {
                facePath = "../content/Image/FaceImage/default_male.jpg";
            }
            return new FileUploadModel()
            {
                overwriteInitial = false,
                maxFileSize = 1500,
                showClose = false,
                showCaption = false,
                showUpload = false,
                showBrowse = false,
                browseOnZoneClick = true,
                defaultPreviewContent = @"<img src='"+facePath+"' alt='FaceImage' style='width:160px'><h6 class='text - muted'>点击选择</h6>",
                allowedFileExtensions = new string[] { "jpg", "png", "gif" }
            };
        }
    }
}
